Skip to content

feat(linter): add options.reportUnusedDisableDirectives to config file#19799

Merged
camc314 merged 8 commits intooxc-project:mainfrom
wagenet:unused-disables-flag
Mar 3, 2026
Merged

feat(linter): add options.reportUnusedDisableDirectives to config file#19799
camc314 merged 8 commits intooxc-project:mainfrom
wagenet:unused-disables-flag

Conversation

@wagenet
Copy link
Contributor

@wagenet wagenet commented Feb 27, 2026

See #15972.

Summary

  • Adds options.reportUnusedDisableDirectives to .oxlintrc.json, following the same pattern as typeAware (feat(linter): introduce typeAware as config options #19614) and typeCheck (feat(linter): introduce typeCheck config option #19764)
  • Root-config-only — nested configs are rejected with a clear diagnostic error
  • CLI --report-unused-disable-directives / --report-unused-disable-directives-severity take precedence over the config file value when both are set
  • Schema (npm/oxlint/configuration_schema.json), TypeScript types (config.generated.ts), and website snapshots regenerated

Test plan

  • Unit tests in oxlintrc.rs: deserialization, is_empty, merge
  • Unit tests in config_store.rs: accessor returns value / None by default
  • Unit tests in config_loader.rs: nested config rejection
  • Integration tests in config_builder.rs: extends inheritance and override precedence
  • cargo test -p oxc_linter && cargo test -p oxlint

Note on AI usage

This PR was implemented with Claude Code assistance and has been reviewed and tested by the contributor.

🤖 Generated with Claude Code

@wagenet wagenet requested a review from camc314 as a code owner February 27, 2026 00:47
Copilot AI review requested due to automatic review settings February 27, 2026 00:47
@github-actions github-actions bot added A-linter Area - Linter A-cli Area - CLI A-linter-plugins Area - Linter JS plugins C-enhancement Category - New feature or request labels Feb 27, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new root-only .oxlintrc.json option to configure reporting of unused disable directives, aligning CLI flags with config-file driven behavior and regenerating the public schema/type artifacts.

Changes:

  • Introduces options.reportUnusedDisableDirectives (Allow/Warn/Deny) in Rust config types, schema, and generated TS types/docs.
  • Enforces “root-config-only” by rejecting nested configs that set the option with a dedicated diagnostic.
  • Wires config into the CLI runner so CLI flags take precedence over config values.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tasks/website_linter/src/snapshots/schema_markdown.snap Updates rendered schema docs snapshot to include the new option.
tasks/website_linter/src/snapshots/schema_json.snap Updates rendered schema JSON snapshot to include the new option.
npm/oxlint/configuration_schema.json Adds schema property for options.reportUnusedDisableDirectives.
crates/oxc_linter/src/config/oxlintrc.rs Adds the option to OxlintOptions, supports merge/is_empty, and adds unit tests for deserialization/merge.
crates/oxc_linter/src/config/config_store.rs Adds a ConfigStore accessor for the new option plus unit tests.
crates/oxc_linter/src/config/config_builder.rs Adds a ConfigStoreBuilder accessor and tests for extends/override behavior.
crates/oxc_linter/fixtures/extends_config/options/report_unused_disable_directives_warn.json New fixture for extends testing (warn).
crates/oxc_linter/fixtures/extends_config/options/report_unused_disable_directives_error.json New fixture for extends testing (error).
crates/oxc_linter/fixtures/extends_config/options/report_unused_disable_directives_allow.json New fixture for extends testing (allow/off).
apps/oxlint/src/lint.rs Uses config value as fallback when CLI flags aren’t set (CLI takes precedence).
apps/oxlint/src/config_loader.rs Rejects nested configs that set options.reportUnusedDisableDirectives, with tests + diagnostic helper.
apps/oxlint/src-js/package/config.generated.ts Regenerates TS config types to include reportUnusedDisableDirectives.

@codspeed-hq
Copy link

codspeed-hq bot commented Feb 27, 2026

Merging this PR will not alter performance

✅ 4 untouched benchmarks
⏩ 52 skipped benchmarks1


Comparing wagenet:unused-disables-flag (3ad58c1) with main (6c0e0b5)2

Open in CodSpeed

Footnotes

  1. 52 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. No successful run was found on main (6ea49a0) during the generation of this report, so 6c0e0b5 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@camc314 camc314 self-assigned this Feb 27, 2026
Copilot AI added a commit to wagenet/oxc that referenced this pull request Feb 27, 2026
…egration tests

Co-authored-by: wagenet <9835+wagenet@users.noreply.github.com>
@Mister-Hope
Copy link

Mister-Hope commented Mar 2, 2026

I see the typecheck option was added in the latest version, which was released minutes ago.

When can this option be supported?

@camc314
Copy link
Contributor

camc314 commented Mar 2, 2026

@Mister-Hope please bear with me - this was only opened on Friday.

@camc314 camc314 force-pushed the unused-disables-flag branch from 6c810fb to 01cb9d7 Compare March 2, 2026 14:06
camc314 pushed a commit to wagenet/oxc that referenced this pull request Mar 2, 2026
…egration tests

Co-authored-by: wagenet <9835+wagenet@users.noreply.github.com>
wagenet and others added 6 commits March 2, 2026 20:22
Closes oxc-project#15972. Adds `options.reportUnusedDisableDirectives` to
`.oxlintrc.json`, following the same pattern as `typeAware` (oxc-project#19614)
and `typeCheck` (oxc-project#19764).

- Root-config-only (nested configs are rejected with a clear error)
- CLI `--report-unused-disable-directives[-severity]` takes precedence
  over the config file value
- Schema, TypeScript types, and website snapshots regenerated

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…egration tests

Co-authored-by: wagenet <9835+wagenet@users.noreply.github.com>
@camc314 camc314 force-pushed the unused-disables-flag branch from c066c16 to b896bcf Compare March 2, 2026 20:29
Copy link
Contributor

@camc314 camc314 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@camc314 camc314 merged commit 61bf388 into oxc-project:main Mar 3, 2026
21 checks passed
graphite-app bot pushed a commit that referenced this pull request Mar 4, 2026
…onfig, change lsp `unusedDisableDirectives` default value to `None` (#20011)

follow up from #19799

Defaults to `None`, allows `Some(allow)` still to override the oxlint config
camc314 pushed a commit that referenced this pull request Mar 9, 2026
# Oxlint
### 🚀 Features

- e6b604f oxlint: Auto-enable gitlab formatter on GitLab (#20076)
(camc314)
- 2488a68 linter: Add .oxlintrc.jsonc config file support (#19870)
(Scott S.)
- 61bf388 linter: Add `options.reportUnusedDisableDirectives` to config
file (#19799) (Peter Wagenet)
- c92422b oxlint: Auto-enable github formatter on GitHub Actions
(#19944) (Boshen)
- 0337c6d linter: Implement typescript/no-unecessary-type-conversion
(#19955) (camc314)
- 2919313 linter: Introduce denyWarnings config options (#19926)
(camc314)
- a607119 linter: Introduce maxWarnings config option (#19777) (camc314)

### 🐛 Bug Fixes

- 0861d9a linter/plugins: Remove getters from `Context` (#20115)
(overlookmotel)
- 92cfb14 linter/plugins: Fix types for `walkProgram` and
`walkProgramWithCfg` (#20081) (overlookmotel)
- 10e211f oxlint/lsp: Send other code actions besides `source.fixAll` if
requested (#20042) (Sysix)
- 602daaa linter/plugins: Fix type definition for `VisitorObject`
(#20065) (overlookmotel)
- ee0491e apps,napi: Explicitly specify libs in tsconfigs (#20071)
(camc314)
- b6e9499 linter: Fix the logic for `unicorn/prefer-dom-node-remove` to
handle literal callees as well as arguments. (#20059) (connorshea)
- 3874ae1 linter: Update `unicorn/prefer-query-selector` to also catch
`getElementsByName()`. (#20060) (connorshea)
- 77c93fb linter: Handle array-type shorthand inside union members
(#20034) (camc314)
- 50eb160 linter/no-unused-vars: Allow unused type params in ambient
module blocks (#19615) (Don Isaac)
- 1dd0d21 linter/no-restricted-imports: Apply regex pattern checks to
side-effect imports (#20028) (camc314)
- 7f3d735 linter: Error when --type-check is used without --type-aware
(#20025) (camc314)
- eea201c unicorn/prefer-string-slice: Avoid unsafe autofix for
substr-to-slice (#20010) (camc314)
- 50359dc oxlint/lsp: Detect `reportUnusedDisableDirectives` from oxlint
config, change lsp `unusedDisableDirectives` default value to `None`
(#20011) (Sysix)
- 4bc84b1 linter/plugins: Allow `null` and `undefined` for
`rule.meta.fixable` (#20008) (overlookmotel)
- 753e27e linter/role-supports-aria-props: Add `aria-posinset` to
supported `option` ARIA properties (#20003) (JongKyung Lee)
- f57b2c9 linter/plugins: Fix return types of tokens methods (#19985)
(overlookmotel)
- 27ee4fc linter/no-loss-of-precision: Avoid double rounding for
negative exponents (#19999) (camc314)
- 77a94bb linter: Avoid no-loss-of-precision false positive for 3e-308
(#19992) (camc314)
- 6245c56 linter/no-unused-private-class-members: Treat logical lhs
access as usage (#19991) (camc314)
- 65891e3 linter: Avoid prefer-const false positive for mixed-scope
destructuring (#19982) (camc314)
- 89991fe linter: Avoid prefer-const false positive for operator
reassignments (#19975) (camc314)
- 87318e7 oxlint/lsp: Load js config with reforcing fs read (#19551)
(Sysix)
- d40a942 linter/no-useless-constructor: Mark fixer as suggestion
(#19961) (camc314)
- ccbd959 linter/prefer-code-point: Report String.fromCharCode member
references (#19931) (camc314)
- 14fbbfc linter: Add help text to oxc/no-rest-spread-properties rule
(#19900) (Subin Kim)

### ⚡ Performance

- 2baa5fb napi: Unify build-test profile to coverage for cache sharing
(#20090) (Boshen)
- 77f1c71 linter/plugins: Make tokens class instances (#19980)
(overlookmotel)
- 758b424 linter/plugins: Reduce memory copies for tokens (#19979)
(overlookmotel)
- 236847f linter/plugins: Cache token objects (#19978) (overlookmotel)
- 94b597a linter/plugins: Store tokens as a `Box<[Token]>` (#19969)
(overlookmotel)

### 📚 Documentation

- 2c0010a linter/plugins: Move comment about "bivariance hack" into
generated code (#20082) (overlookmotel)
- 7538f09 linter: Improve `import/extensions` and
`import/no-named-as-default` rule docs. (#20053) (connorshea)
- 1f909cf linter: Improve docs for
`unicorn/require-post-message-target-origin` rule. (#20061) (connorshea)
- 12ae35c oxlint/lsp: Remove outdated ToDo for `LintOptions.run`
(#20012) (Sysix)
- 3be73e6 linter/plugins: Fix JSDoc comments for tokens methods (#20004)
(overlookmotel)
- 48ef285 linter: Update `--config` docs (#19965) (camc314)
- 6ea49a0 linter: Fix some identation issues for the generated types
used in `oxlint.config.ts`. (#19942) (connorshea)
- 6c0e0b5 linter: Add oxlint.config.ts to the config docs. (#19941)
(connorshea)
- 160e423 linter: Add a note that the typeAware and typeCheck options
require oxlint-tsgolint (#19940) (connorshea)
- d54c275 linter: Improve rule docs for 27 unicorn rules (#19903)
(connorshea)
# Oxfmt
### 🚀 Features

- ee26215 oxfmt: Support css-in-js substitution (#20019) (leaysgur)
- 0f0ff51 oxfmt: Display default settings was used message in cli stats
(#19939) (leaysgur)
- 88815b8 oxfmt: Reintroduce stats line for write mode (#19938)
(leaysgur)

### 🐛 Bug Fixes

- ee0491e apps,napi: Explicitly specify libs in tsconfigs (#20071)
(camc314)
- 92f4490 oxfmt: Apply `is_ignored_dir` for glob paths too (#20056)
(leaysgur)
- 114f974 oxfmt/lsp: Prefer language_id over file extension when
formatting (#19977) (copilot-swe-agent)

### ⚡ Performance

- 2baa5fb napi: Unify build-test profile to coverage for cache sharing
(#20090) (Boshen)

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-cli Area - CLI A-linter Area - Linter A-linter-plugins Area - Linter JS plugins C-enhancement Category - New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants